function checkFlag(obj, dataid, flag) {
	var _obj = $(obj);
	var param = {
		"id" : dataid,
		"flag" : flag,
	}
	
	API.diseaseIndexCheckFlag(param, function(res) {
		if(res.code == 0) {
			
		} else {
			alert(res.desc);
		}
	});
}

function submitSearch(obj, name) {
	if(UTIL.checkButton(obj)) {
		var indexNameKey = $("#indexNameKey").val();
		if(indexNameKey) {
			var param = {'name':name, 'indexNameKey':indexNameKey};
			
			API.diseaseIndexSearchList(param, function(res) {
				if(res.code == 0) {
					// 先删除列表所有数据
					$("index-tr").remove();
					
					// 逐条添加数据
					var list = res.data.list;
					var indexHr = '';
					for(var i in list) {
						var index = list[i];
						indexHr += '<tr><td align="center">';
						indexHr += index.diseaseName;
						indexHr += '</td><td align="center">';
						indexHr += index.indexName;
						indexHr += '</td><td align="center"><label><input name="';
						indexHr += index.id;
						indexHr += '" type="radio" value="0" ';
						if(index.blackFlag==0) {
							indexHr += 'checked';
						}
						indexHr += ' onclick="checkFlag(this, ';
						indexHr += index.id;
						indexHr += ', \'0\');">白名单</label><label><input name="';
						indexHr += index.id;
						indexHr += '" type="radio" value="0" ';
						if(index.blackFlag==1) {
							indexHr += 'checked';
						}
						indexHr += ' onclick="checkFlag(this, ';
						indexHr += index.id;
						indexHr += ', \'0\');">黑名单</label>';
						indexHr += '</td></tr>';
					}
					
					var indexTable = $('#index_list');
					indexTable.html('<tr><th style="width: 35%;">疾病名称</th><th style="width: 35%;">指标名称</th><th>黑白名单</th></tr>' + indexHr);
				} else {
					alert(res.desc);
				}
			});
		}
		UTIL.releaseButton(obj);
	}
}